import java.util.*;
public class ArrayDiffK  {
	static int findElementsWithDiffK(int input[], int k)
	{
		Map<Integer, Integer> arrayMap = new HashMap<Integer,Integer>();
		if(k==0)
		{
			for(int i = 0; i < input.length; i++)
			{

				if(arrayMap.containsKey(input[i]))
					arrayMap.put(input[i],arrayMap.get(input[i])+1);

				else
					arrayMap.put(input[i],1);
				}	

				Iterator mapIter = arrayMap.entrySet().iterator();
				while(mapIter.hasNext())
				{
					Map.Entry mapEntry = (Map.Entry) mapIter.next();

					if((int)mapEntry.getValue() > 1)
					System.out.println(mapEntry.getKey()+","+mapEntry.getKey());
				}

				
		}
		else
		{
		for(int i = 0; i < input.length; i++)
		arrayMap.put(input[i],input[i]-k);

		Iterator mapIter = arrayMap.entrySet().iterator();
		
		while(mapIter.hasNext())
		{
			Map.Entry mapEntry = (Map.Entry) mapIter.next();
			if(arrayMap.containsKey(arrayMap.get(mapEntry.getKey())))
				System.out.println(mapEntry.getValue()+","+ mapEntry.getKey());

			
		}

		}		
		return(0);
	}
	

	public static void main(String[] args) {
		int[] input = {3,6,10,13,15,16,17,18,19,3,6,10};
		findElementsWithDiffK(input, 6);
	}
}